<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 86185
  Date: 2021/4/26
  Time: 9:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学生列表</title>
</head>
<script src="/layui/layui.all.js"></script>
<script src="/jQuery/jquery-3.1.1.js"></script>
<link rel="stylesheet" href="/layui/css/layui.css" type="text/css">
<body>
<center>
<div style="width: 1000px;height: 500px">
    <a onclick="a()" class="layui-btn layui-btn-normal" >添加</a>
    <table border="1px" class="layui-table">
        <tr class="layui-table-body">
            <td>学生编号</td>
            <td>学生姓名</td>
            <td>学生生日</td>
            <td>身份证</td>
            <td>手机号</td>
            <td>班级编号</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${list}" var="stu" >
            <tr class="layui-table-body">
            <td>${stu.stuno}</td>
            <td>${stu.stuname}</td>
            <td>${stu.birthday}</td>
            <td>${stu.idcard}</td>
            <td>${stu.phone}</td>
            <td>${stu.classid}</td>
                <td colspan="2">
                    <button onclick="del('${stu.stuno}')" class="layui-btn layui-btn-danger">删除</button>
                    <a href="/stu/updStu?stuno=${stu.stuno}" class="layui-btn layui-btn-normal">修改</a>
               </td>
            </tr>
        </c:forEach>
    </table>
    <c:if test="${pageInfo.isFirstPage}">
        <a  class="layui-btn layui-btn-normal">上一页</a>
    </c:if>
    <c:if test="${pageInfo.isLastPage}">
        <a  class="layui-btn layui-btn-normal">下一页</a>
    </c:if>
    <c:if test="${pageInfo.isFirstPage!=true}">
        <a href="/stu/select?pageNum=${pageInfo.prePage}&pageSize=${pageInfo.pageSize}" class="layui-btn layui-btn-normal">上一页</a>
    </c:if>
    <c:if test="${pageInfo.isLastPage!=true}">
        <a href="/stu/select?pageNum=${pageInfo.nextPage}&pageSize=${pageInfo.pageSize}" class="layui-btn layui-btn-normal">下一页</a>
    </c:if>

   总页数${pageInfo.pages}/当前页${pageInfo.pageNum}

</div>
</center>
</body>

<script>
    function a() {
      layer.open({
          type:2,
          area:['600px','600px'],
          title:'学生添加界面',
          content:'http://localhost:8080/stu/selectC'
          }
      )
    }
    function del(stuno) {
        $.post("/stu/del",{"stuno":stuno},function (data) {
            if(data!=0){
               layer.alert("删除成功")

                window.location.reload()
            }
        })
    }
    function upd(list) {

    }
</script>
</html>
